package org.sems.sems.Mapper;

import org.sems.sems.entity.Zphzydyk;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ZphzydykMapper {
    @Insert("INSERT INTO ZPHZYDYK(ZPHDM, ZYDM) VALUES(#{zphdm}, #{zydm})")
    int insertZphzydyk(Zphzydyk zphzydyk);

    @Select("SELECT c.*," +
            "( select count(*) from DATA_STUDENT where ZYDM = c.ID ) as SJXSS " +
            "FROM ZPHZYDYK  a " +
            "left join DATA_ZPHJLK b on a.ZPHDM=b.ID " +
            "left join ZYDMK c on a.ZYDM=c.ID WHERE ZPHDM = #{zhpdm}")
    List<Map<String, Object>> getZydmByZhpdm(int zhpdm);
}
